home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
doom
/
cddk9605.zip
/
HEADERS.ARJ
/
XDOS.INT
< prev
next >
Wrap
Text File
|
1996-05-17
|
19KB
|
596 lines
{ ───────────────────────────────────────────────────────────────────────── }
{ Name : XDOS.PAS }
{ Description : Extended DOS unit }
{ ───────────────────────────────────────────────────────────────────────── }
UNIT xDOS;
{$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
{$F+} { . . . . . . . . . . . . . . . . . . . . Force far calls for safety }
{$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
{$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
{$Q-} { . . . . . . . . . . . . . . Do not generate overflow-checking code }
{$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
{$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
{$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
INTERFACE
CONST
{ CPU Flags }
fCarry = $0001; { ........ .......1 }
fParity = $0004; { ........ .....1.. }
fAuxiliary = $0010; { ........ ...1.... }
fZero = $0040; { ........ .1...... }
fSign = $0080; { ........ 1....... }
fOverflow = $0800; { 1....... ........ }
{ DOS Memory }
dmRAM = $00; { .....0.. }
dmROM = $04; { .....1.. }
dmConv = $00; { ....0... }
dmHigh = $08; { ....1... }
{ File Attributes }
faNormal = $00; { ........ }
faReadOnly = $01; { .......1 }
faHidden = $02; { ......1. }
faSysFile = $04; { .....1.. }
faVolumeID = $08; { ....1... }
faDirectory = $10; { ...1.... }
faArchive = $20; { ..1..... }
faAnyFile = $3F; { ..111111 }
{ File Contains... }
fcExtension = $0001; { .......1 }
fcFileName = $0002; { ......1. }
fcDirectory = $0004; { .....1.. }
fcWildcards = $0008; { ....1... }
{ File Modes }
fmReadOnly = $00; { .....000 }
fmWriteOnly = $01; { .....001 }
fmReadWrite = $02; { .....010 }
fmCompat = $00; { .000.... }
fmDenyAll = $10; { .001.... }
fmDenyWrite = $20; { .010.... }
fmDenyRead = $30; { .011.... }
fmDenyNone = $40; { .100.... }
fmNoInherit = $70; { 1....... }
{ Filespec Lengths }
fsPathName = 79;
fsDirectory = 67;
fsFileName = 08;
fsExtension = 04;
{ Standard File Modes }
fmClosed = $D7B0;
fmInput = $D7B1;
fmOutput = $D7B2;
fmInOut = $D7B3;
TYPE
{ FileSpec Strings }
PathStr = ARRAY[0..fsPathName] OF Char;
DirStr = ARRAY[0..fsDirectory] OF Char;
NameStr = ARRAY[0..fsFileName] OF Char;
ExtStr = ARRAY[0..fsExtension] OF Char;
{ BIOS Support }
tBIOS = RECORD
SerialPort : ARRAY [0..3] OF Word;
ParallelPort : ARRAY [0..3] OF Word;
EquipFlags : Word;
MfgrTestFlags : Byte;
MainMem : Word;
ExpRam : Word;
KbdStat : Word;
KeyPad : Byte;
KbdBuffHead : Word;
KbdBuffTail : Word;
KbdBuff : ARRAY [0..31] OF Char;
SeekStatus : Byte;
MortotStatus : Byte;
MortoCnt : Byte;
DiskError : Byte;
NECStatus : ARRAY [0..6] OF Byte;
VideoMode : Byte;
ScreenWidth : Word;
VideoBufferSize : Word;
VideoBufferOfs : Word;
CursorPos : ARRAY [0..7,0..1] OF Byte;
CursorBottom : Byte;
CursorTop : Byte;
ActiveDisplayPage : Byte;
ActiveDisplayPort : Word;
CRTModeReg : Byte;
Palette : Byte;
DataEdgeTimeCount : Word;
CRCReg : Word;
LastCharInput : Char;
Tick : Word;
Hour : Integer;
TimerOverFlow : Byte;
BreakStatus : Byte;
ResetFlag : Word;
HardDiskStatus : LongInt;
ParallelTimeout : ARRAY[0..3] OF Byte;
SerialTimeout : ARRAY[0..3] OF Byte;
KbdBufferOfs : Word;
KbdBufferEnd : Word;
END;
pBIOS = ^tBIOS;
tDateTime = RECORD
Year : Word;
Month : Word;
Day : Word;
Hour : Word;
Min : Word;
Sec : Word;
END;
pDateTime = ^tDateTime;
tRegisters = RECORD
CASE Integer OF
0 : (AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags: Word);
1 : (AL, AH, BL, BH, CL, CH, DL, DH: Byte);
END;
pRegisters = ^tRegisters;
tSearchRec = RECORD
Fill : ARRAY[1..21] OF Byte;
Attr : Byte;
Time : Longint;
Size : Longint;
Name : ARRAY[0..12] OF Char;
END;
pSearchRec = ^tSearchRec;
SO = RECORD { Segment:Offset }
S : Word;
O : Word;
END;
{ ----------------------------- }
{ TurboPascal File Structures }
{ ----------------------------- }
tFileRec = RECORD
Handle : Word;
Mode : Word;
RecSize : Word;
PrivData : ARRAY[1..26] OF Byte;
UserData : ARRAY[1..16] OF Byte;
Name : ARRAY[0..79] OF Char;
END;
tTextBuf = ARRAY[0..127] OF Char;
pTextBuf = ^tTextBuf;
tTextRec = RECORD
Handle : Word;
Mode : Word;
BufSize : Word;
PrivData : Word;
BufPos : Word;
BufEnd : Word;
BufPtr : pTextBuf;
OpenFunc : Pointer;
InOutFunc : Pointer;
FlushFunc : Pointer;
CloseFunc : Pointer;
UserData : ARRAY[1..16] OF Byte;
Name : ARRAY[0..79] OF Char;
Buffer : tTextBuf;
END;
CONST
CommandLine : STRING[127] = '';
Days : ARRAY[1..12] OF Byte = (31,28,31,30,31,30,31,31,30,31,30,31);
FileNameSet : SET OF Char =
['!','#'..')',#45,#46,'0'..':','@'..'Z','\','`'..#123,#125,'~','_'];
Reserved_Name : ARRAY[1..14] OF STRING[8] = (
{01} 'AUX', { Auxiliary device }
{02} 'CLOCK$', { System clock }
{03} 'COM1', { Communications port 1 }
{04} 'COM2', { Communications port 2 }
{05} 'COM3', { Communications port 3 }
{06} 'COM4', { Communications port 4 }
{07} 'CON', { Console }
{08} 'EMMXXXX0', { Expanded Memory Manager }
{09} 'LPT1', { Parallel port 1 }
{10} 'LPT2', { Parallel port 2 }
{11} 'LPT3', { Parallel port 3 }
{12} 'NUL', { Nul output device }
{13} 'PRN', { Printer }
{14} 'XMSXXXX0'); { Extended Memory Manager }
CONST
DOSError : Integer = 0;
VAR
BIOS : tBIOS ABSOLUTE Seg0040;
IPCA : ARRAY[1..16] OF Byte ABSOLUTE $0000:$04F0;
Ticks : LongInt ABSOLUTE $0040:$006C;
FUNCTION AppendSlash(p:pChar):pChar;
{
PURPOSE : Appends a slash to the directory name.
NOTES : A slash is not appended if the string is empty. An empty
directory path generally implies the current directory, not
the root directory.
}
PROCEDURE ChangeDirectory(Dir:pChar);
{
PURPOSE : Changes to the specified directory.
NOTES : The result is saved in DOSError.
}
PROCEDURE ChangeDrive(Drive:Byte);
{
PURPOSE : Changes to the specified drive.
NOTES : 1 = Drive A
2 = Drive B
3 = Drive C
4 = Drive D
etc...
SEE ALSO : CurrentDrive
}
PROCEDURE ColdReboot;
{
PURPOSE : Performs a cold reboot of the system.
NOTES : A cold reboot includes the memory test on many PCs.
This method of rebooting may be incompatible with some
multitasking operating systems. Use HardwareReset if
this command causes a General Protection Fault (GPF).
SEE ALSO : HardwareReset, WarmReboot
}
FUNCTION CorrectPathName(Dest,Raw,Dir,Ext:pChar):pChar;
{
PURPOSE : Generates a string with the proper directory and extension.
PARAMS : Dest Destination string.
Raw Filespec to process.
Dir